<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原型-面试题</title>
</head>
<body>

<script type="text/javascript">
    /*
        测试题 1

    */
    var A = function(){
    }
    A.prototype.n = 1

    var b = new A()

    A.prototype = {
        n:2,
        m:3
    }

    var c = new A()
    console.log(b.__proto__)
    console.log(A.prototype)
    console.log(b.n, b.m, c.n, c.m) // 1 undefined   2 3

    /*
        测试题 2
            根据[ 探索instanceof（二）] 的图来解
    */
    function F(){

    }
    Object.prototype.a = function(){
        console.log('a()')
    }
    Function.prototype.b = function(){
        console.log('b()')
    }
    var f = new F()
    f.a()
    f.b()
    F.a()
    F.b()

</script>
</body>
</html>